package com.yunshang.shoppingmall.service;

import com.yunshang.shoppingmall.entity.Address;
import org.apache.ibatis.annotations.Param;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

import static org.springframework.transaction.annotation.Propagation.REQUIRED;

public interface AddressService {
    int deleteByPrimaryKey(Integer id);

    int insert(Address record);

    int insertSelective(Address record);

    Address selectByPrimaryKey(Integer id);
    Address selectByUserIdTwo(Integer id);
    int updateByPrimaryKeySelective(Address record);

    @Transactional(propagation = REQUIRED)
    int updateByPrimaryKey(Address record);

    List<Address> selectAddressAll();
    List<Address> selectDefaultMore(@Param("isdefault") Integer isdefault,@Param("userId") Integer userId);
    Address selectById(Integer id);
    Address selectLogType(Integer id);
    List<Address> selectByUserId(Integer userId);
    Address selectDefault(@Param("isdefault") Integer isdefault, @Param("userId") Integer userId);
    int updateAddressIsMoreAddressByUserId(@Param("userId") int userId);
    //修改默认地址
    int updateDefaultAddress( int id);

    //更新某一个用户的地址只有一个为默认地址
    int updateAddressStateByUserId(int userId);
}
